@layout("/backend/common/_container.html"){
<div class="dhcc-form" id="userInfoForm">

    <input type="hidden" id="id" value="${user.id}">
    <input type="hidden" id="sexValue" value="${user.sex}">
    <input type="hidden" id="status" value="${user.status}">

    <#Input id="loginName" name="登录名" value="${user.loginName}"/>

    <#Input id="name" name="姓名" value="${user.name}"/>

    <#Input id="userCode" name="工号" value="${user.userCode}"/>

    <#Radio id="sex" name="性别" code="sex" value="${user.sex}"/>

    <#Date id="birthday" name="出生日期" value="${user.birthday}" />

    <#Input id="email" name="邮箱" type="email" value="${user.email}"/>

    <#Input id="phone" name="电话" value="${user.phone}"/>

    <#Input id="weight" name="排序" value="${user.weight}" type="number"/>

    <#SelectTree id="position" name="职务" url="/position/tree" selectRoot="false" value="${position.id}" textValue="${position.name}"/>

    <div class="form-group">
        <label class="lab">主部门</label>
        <div class="ele">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="40%">部门</th>
                    <th>角色</th>
                </tr>
                </thead>
                <tbody>
                @var hasMan = false;
                @if(!isEmpty(deptRoles)){
                @for(ele in deptRoles){
                @if(ele.isPartTime==0){
                @hasMan = true;
                <tr>
                    <td>
                        <input class="textbox" style="width:100%" value="${ele.deptName}" id="dept" type="text" readonly="readonly" onclick="UserInfoDlg.showDeptSelectTree(this);" style="background-color: #ffffff !important;">
                        <input class="textbox" style="width:100%" value="${ele.deptId}" type="hidden" id="dept_id" name="dept_id">
                    </td>
                    <td>
                        <input class="textbox" style="width:100%" value="${ele.roleNames}" id="role" type="text" readonly="readonly" onclick="UserInfoDlg.showRoleSelectTree(this);" style="background-color: #ffffff !important;">
                        <input class="textbox" style="width:100%" value="${ele.roleIds}" type="hidden" id="role_id" name="role_id">
                    </td>
                </tr>
                @}
                @}
                @}
                @if(!hasMan){
                <tr>
                    <td>
                        <input class="textbox" style="width:100%" id="dept" type="text" readonly="readonly" onclick="UserInfoDlg.showDeptSelectTree(this);" style="background-color: #ffffff !important;">
                        <input class="textbox" style="width:100%" type="hidden" id="dept_id" name="dept_id">
                    </td>
                    <td>
                        <input class="textbox" style="width:100%" id="role" type="text" readonly="readonly" onclick="UserInfoDlg.showRoleSelectTree(this);" style="background-color: #ffffff !important;">
                        <input class="textbox" style="width:100%" type="hidden" id="role_id" name="role_id">
                    </td>
                </tr>
                @}
                </tbody>
            </table>
        </div>
    </div>
    <div class="form-group">
        <label class="lab">兼职部门</label>
        <div class="ele">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="40%">部门</th>
                    <th>角色</th>
                    <th width="60px">
                        <button type="button" class="btn btn-success btn-xs " onclick="UserInfoDlg.addItem()">
                            <i class="fa fa-plus"></i>
                        </button>
                    </th>
                </tr>
                </thead>
                <tbody id="_tbody">
                @if(!isEmpty(deptRoles)){
                @for(ele in deptRoles){
                @if(ele.isPartTime==1){
                <tr>
                    <td>
                        <input class="textbox" style="width:100%" value="${ele.deptName}" id="dept_${eleLP.index}" type="text" readonly="readonly" onclick="UserInfoDlg.showDeptSelectTree(this);" style="background-color: #ffffff !important;">
                        <input class="textbox" style="width:100%" value="${ele.deptId}" type="hidden" id="dept_${eleLP.index}_id" name="dept_id">
                    </td>
                    <td>
                        <input class="textbox" style="width:100%" value="${ele.roleNames}" id="role_${eleLP.index}" type="text" readonly="readonly" onclick="UserInfoDlg.showRoleSelectTree(this);" style="background-color: #ffffff !important;">
                        <input class="textbox" style="width:100%" value="${ele.roleIds}" type="hidden" id="role_${eleLP.index}_id" name="role_id">
                    </td>
                    <td>
                        <button type="button" class="btn btn-danger" onclick="UserInfoDlg.delItem(this)">
                            <i class="fa fa-remove"></i>
                        </button>
                    </td>
                </tr>
                @}
                @}
                @}
                </tbody>
            </table>
        </div>
    </div>

    <div class="toolbar">
        <#Button name="保存" id="ensure" icon="icon-w-save" clickFun="UserInfoDlg.editSubmit()"/>
        <#Button btnCss="l-bt-red" name="关闭" id="cancel" icon="icon-w-close" clickFun="UserInfoDlg.close()"/>
    </div>
</div>

<script src="${ctxPath}/static/backend/system/user/user_info.js"></script>
@}
